local yeQihai = fk.CreateSkill({
  name = "ye__qihai",
  tags = { Skill.Compulsory },
})

Fk:loadTranslationTable{
  ["ye__qihai"] = "启海",
  [":ye__qihai"] = "锁定技，当你使用基本牌时，你摸两张牌，以此法获得的牌本回合不计入手牌上限，当你使用普通锦囊牌时，你回复一点体力，当你使用装备牌时，你使用的下一张牌不计入次数且无次数限制。",

  ["@@ye__qihai-inhand-turn"] = "启海",
  ["@@ye__qihai_use"] = "无次数限制",
}

yeQihai:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(yeQihai.name) and data.card.type==Card.TypeBasic
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(2, yeQihai.name, nil, "@@ye__qihai-inhand-turn")
  end,
})

yeQihai:addEffect("maxcards", {
  exclude_from = function(self, player, card)
    return card:getMark("@@ye__qihai-inhand-turn") > 0
  end,
})

yeQihai:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(yeQihai.name) and data.card and data.card:isCommonTrick()
  end,
  on_use = function(self, event, target, player, data)
    player.room:recover{
      who = player,
      num = 1,
      recoverBy = player,
      skillName = yeQihai.name,
    }
  end,
})

yeQihai:addEffect(fk.CardUsing, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(yeQihai.name) and data.card.type == Card.TypeEquip and player:getMark("@@ye__qihai_use") < 1
  end,
  on_use = function(self, event, target, player, data)
    player.room:addPlayerMark(player, "@@ye__qihai_use")
  end,
})
yeQihai:addEffect(fk.PreCardUse, {
  can_refresh = function (self, event, target, player, data)
    return target == player and player:getMark("@@ye__qihai_use") > 0 
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:setPlayerMark(player, "@@ye__qihai_use", 0)
    data.extraUse = true
  end,
})
yeQihai:addEffect("targetmod", {
  bypass_times = function (self, player, skill, scope, card)
    return card and player:getMark("@@ye__qihai_use") > 0
  end,
})


return yeQihai
